package com.k2data.k2app.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.k2data.k2app.constant.Constant;
import com.k2data.k2app.domain.po.v1.Contacts;
import com.k2data.k2app.domain.po.v1.Event;
import com.k2data.k2app.domain.po.v1.RFile;
import com.k2data.k2app.rest.domain.Region;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Transient;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.ZonedDateTime;
import java.util.List;
import java.util.Map;

/**
 * @author lidong9144@163.com 17-3-16.
 */
@Data
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DeviceDTO implements Serializable {

    @Transient
    private static final long serialVersionUID = -7403724587501739115L;

    // Device columns
    private String deviceNo;
    private String pinCode;
    private String type;
    private String typeEn;
    private String spec;
    private String certificateNo;
    @JsonFormat(pattern = Constant.ISO_FORMAT)
    private ZonedDateTime produceDate;
    @JsonFormat(pattern = Constant.ISO_FORMAT)
    private ZonedDateTime operationDate;
    private String status;
    private String name;
    private String fullName;
    private String owner;
    @JsonFormat(pattern = Constant.ISO_FORMAT)
    private ZonedDateTime latestRepairDate;
    private String remark;
    private Long tDeviceId;
    private String equipmentName;
    private String keyName;
    private String templateImageUrl;
    private String overviewUrl;

    private String customerNo;
    private String dataSource;

    private Long id;
    private Long parentId;
    private Long rootId;
    private Long key;
    private Long groupId;
    private Long customerId;
    private String groupNo;
    private String groupName;
    private Double longitude;
    private Double latitude;
    private Region region;
    private String customerType;
    private String customerName;
    private String industry;
    private String imageUrl;
    private List<String> dataSources;
    private Map<String, Long> statuses;
    private String priorStatus;
    private Integer priorStatusCount;
    private Map<String, Long> faults;
    private String address;
    private String contactPerson;
    private String tel;
    private String mobile;

    private String iconUrl;

    private Integer count;
    private Integer onlineCount;
    private Integer alarmCount;
    private Integer customerCount;


    private String pinyin;
    private String py;
    private String pyFirst;
    /**
     * 开机时长
     */
    private Double hours;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate startDate;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate endDate;

    private List<DeviceDTO> children;
    private CustomerDTO customer;
    private BomDTO tDevice;
    private List<RFile> fileList;
    private List<Contacts> contacts;
    private List<String> permission;
    private String editPermission;
    private String delPermission;

    private List<Event> faultsv2;

    private String startTimeLast;
    public DeviceDTO(String name,String pinyin,String py){
        this.name=name;
        this.pinyin=pinyin;
        this.py = py;
    }

}
